package com.pengweiwei.androidzygote.mine.data;

import com.putong35.common.app.BaseApplication;
import com.putong35.common.httprequest.OnFailureListener;
import com.putong35.common.httprequest.OnSuccessListener;
import com.putong35.common.httprequest.retrofit.HttpCommonCallback;

import java.util.HashMap;

import retrofit2.Call;
import retrofit2.Retrofit;

public class MineApiHelper {
    /**
     * 反馈信息
     *
     * {"appVersion":"1.0","content":"反馈内容","type":"1(数字顺序和问题顺序一样)"}
     *
     * @param type            [1:内容报错; 2: 资源相关; 3: 功能建议; 4: 其他]
     * @param successListener
     * @param failureListener
     */
    public static void feedback(String content, int type, OnSuccessListener<String> successListener, OnFailureListener failureListener) {
        Retrofit retrofit = BaseApplication.retrofit();
        MineApi request = retrofit.create(MineApi.class);

        HashMap<String, String> map = new HashMap<>();
        map.put("appVersion", "1.0");
        map.put("content", content);
        map.put("type", "" + type);

        Call<String> call = request.feedback(map);
        HttpCommonCallback<String> callback = new HttpCommonCallback<>(successListener, failureListener);
        call.enqueue(callback);
    }




}
